#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QHBoxLayout>
#include <QTabWidget>

#include "jsonitem.h"
#include "timeitem.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    onInit(); // 初始化
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::onInit()
{
    this->setWindowTitle("工具箱");

    QHBoxLayout *mainLayout = new QHBoxLayout(ui->centralwidget);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    // 添加 tabwidget 到 layout
    QTabWidget *tabWidget = new QTabWidget();
    tabWidget->setTabsClosable(true);
    mainLayout->addWidget(tabWidget);
    tabWidget->addTab(new JsonItem(), "JSON工具箱");
    tabWidget->addTab(new TimeItem(), "时间戳");
}


